<?php
// REQUIRED
	include '../../kernel.php';

// SECURITY CHECK
	if(!isset($user) || !$user->isLoggedIn()) die('No permission!');
	$domain_id = (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) ? $_REQUEST['id'] : die('No permission!');

// GET LANGUAGES
	$sql = "SELECT id, domain_id, name, short, active, `default` FROM ".$db->table('languages')." WHERE domain_id = '".addslashes($domain_id)."' ORDER BY name";
	$res = mysql_query($sql) or $cosa->kill('Error while fetching languages from domain.', 'db');

// RETURN LANGUAGES
	echo '<option value="">'.$lang->get('dropdown-please-select').'</option>';
	while($row = mysql_fetch_array($res, MYSQL_ASSOC)) {
		if($user->hasLangPermission($row['id'])) {
			echo '<option value="'.stripslashes($row['id']).'">'.stripslashes($row['name']).'</option>'."\n";
		}
	}

?>